<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>json1测试</title>
    <script src="../js/jquery-2.1.4.min.js"></script>

</head>
<body>
name:<span id="name"></span>
sex:<span id="sex"></span>
age:<span id="age"></span>
<script>
    var JSONObject={
        "name":"zhuchangjing",
        "sex":"female",
        "age":23,

    }
    //DOM根据ID获取元素时必须在HTML元素后
    //DOM
    /*document.getElementById("name").innerHTML=JSONObject.name;
     document.getElementById("sex").innerHTML=JSONObject.sex;
     document.getElementById("age").innerHTML=JSONObject.age;*/
    //jQuery
    $(function () {
        $('#name').html(JSONObject.name);
        $('#sex').html(JSONObject.sex);
        $('#age').html(JSONObject.age);

    });
</script>
</body>
</html>